package it.massetti.scoponescientifico.game;


import java.io.Serializable;
import java.util.List;

public interface GameAction extends Serializable {
	/**
	 * Before apply the action it must check this method.
	 * It checks if the state of the game is coherent with the action.
	 * @param state the state of the game
	 * @return true if the action can be made, false otherwise. N.B: this method checks only if the state of the game is correct.
	 */
	Boolean isLegal(Game state);
	
	/**
	 * This method change the state of the game.
	 * If there's an exception it restores the state of the game and change the notification to send to the observers
	 * @param state the state of the game
	 * @return the list of changes.
	 */
	List<NotificationMessage> apply(Game state);

}
